#include<iostream>
#include<vector>
using namespace std;

vector<int> path;
void dfs(int n, int m, int pos)
{
    if (path.size() == m)
    {
        for (auto& num : path)
        {
            cout << num << " ";
        }
        cout << endl;
        return;
    }

    for (int i = pos; i <= n; i++)
    {
        path.push_back(i);
        dfs(n, m, i + 1);
        path.pop_back();
    }
}

int main()
{
    int m = 0;
    int n = 0;
    cin >> n >> m;
    dfs(n, m, 1);

    return 0;
}